package com.source.lightfowl.basedata.controller;

import com.source.lightfowl.basedata.entity.MachineStatusList;
import com.source.lightfowl.basedata.entity.SlaughterHouse;
import com.source.lightfowl.basedata.service.BarcodeMachineChartService;
import com.source.lightfowl.utils.MyResult;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:
 * @Author: Faink
 * @CreateTime: 2020/9/12 19:51
 */
@Api(tags = "设备状态图表集")
@CrossOrigin
@RestController
@RequestMapping(value = "/MachineChart")
public class BarcodeMachineChartController {
    @Autowired
    private BarcodeMachineChartService barcodeMachineChartService;

    /*
    9.10 扩展2个方法
        1. 根据市场名字模糊查询
        2. 根据市场id查询设备的状态 返回分类的结果
    9.15
        排序 + 档口信息 +联系人


     */

    //根据市场id 查询设备状态 分类之后返回
    @GetMapping(value = "/find/by/houseId")
    public MyResult getMachineStatusBySlaughteHouseId(Integer id){

        List<MachineStatusList> result = barcodeMachineChartService.getMsgById(id);
        return MyResult.build(0,"成功",result);
    }

    //根据市场id 设别状态查询脚标机 未测试
    @GetMapping(value = "/find/by/houseIdAndStatus")
    public MyResult getMachineStatusBySlaughteHouseId2(Integer id,String status){

        MachineStatusList result = barcodeMachineChartService.getMsgByIdAndStatus(id,status);
        return MyResult.build(0,"成功",result);
    }


}
